package com.example.customviewapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.LayoutAnimationController;
import android.view.animation.RotateAnimation;
import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

public class MainActivity extends AppCompatActivity {

    private LinearLayout linearLayout;

    private ImageView imageView;
    private RotateAnimation rotateAnimation;

    private RelativeLayout relativeLayout;

    private Button button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_main_ripple);
        button = findViewById(R.id.other_activity);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                /*Intent intent = new Intent(MainActivity.this,CircleRevealActivity.class);
                startActivity(intent);*/
                Notification.Builder builder = new Notification.Builder(MainActivity.this);
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.baidu.com"));
                PendingIntent pendingIntent  = PendingIntent.getActivity(MainActivity.this,
                        0,intent,0);
                builder.setSmallIcon(R.drawable.ic_launcher_background);
                builder.setContentIntent(pendingIntent);
                builder.setContentTitle("Basic Notification");
                builder.setContentText("I am a basic notification");
                builder.setSubText("it is really basic");
                NotificationManager notificationManager = (NotificationManager) getSystemService(
                        NOTIFICATION_SERVICE
                );
                notificationManager.notify(0,builder.build());
            }
        });
      //  linearLayout = findViewById(R.id.line_layout);
        /*linearLayout.removeAllViews();
        RewriteMeasureView rewriteMeasureView = new RewriteMeasureView(this);
        linearLayout.addView(rewriteMeasureView);*/


       /* imageView = findViewById(R.id.image_view);
        rotateAnimation = new RotateAnimation(0,360,RotateAnimation.RELATIVE_TO_SELF,0.5F,
                RotateAnimation.RELATIVE_TO_SELF,0.5F);
        rotateAnimation.setDuration(2000);

        AnimationSet animationSet = new AnimationSet(true);
        animationSet.setDuration(3000);
        AlphaAnimation alphaAnimation = new AlphaAnimation(0,1);
        alphaAnimation.setDuration(3000);
        animationSet.addAnimation(alphaAnimation);
        TranslateAnimation translateAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_SELF,
                TranslateAnimation.RELATIVE_TO_SELF+100,TranslateAnimation.RELATIVE_TO_SELF,
                TranslateAnimation.RELATIVE_TO_SELF+100 );
        translateAnimation.setDuration(3000);
        animationSet.addAnimation(translateAnimation);

        //imageView.startAnimation(animationSet);
        rotateAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                imageView.startAnimation(rotateAnimation);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });

        relativeLayout = findViewById(R.id.parent_layout);
        ScaleAnimation scaleAnimation = new ScaleAnimation(0,1,0,1);
        scaleAnimation.setDuration(2000);
        LayoutAnimationController layoutAnimationController = new LayoutAnimationController(scaleAnimation,
                0.5f);
        layoutAnimationController.setOrder(LayoutAnimationController.ORDER_NORMAL);
        relativeLayout.setLayoutAnimation(layoutAnimationController);
*/


    }

    @Override
    protected void onStart() {
        super.onStart();
        //imageView.startAnimation(rotateAnimation);
        //imageView.animate().x(200).y(300).setDuration(5000).start();
    }
}
